<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #container{
            width:80%;
            height: 500px;
            border:1px solid red;
            margin: 10px auto;
            display: flex;
            flex-flow:row wrap;
            justify-content: space-between;
            align-content:space-around;
        }
        #container div{
            width:200px;
            height: 200px;
            background-color:blue;
        }
    </style>
</head>
<body>
<div id="container">
    <div>1</div>
    <div>2</div>
    <div>3</div>
    <div>4</div>
    <div>5</div>
    <div>6</div>
    <div>7</div>
    <div>8</div>

</div>
</div>
</body>
</html>